package FMainController;

import java.util.*;
import java.io.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;



public class MFirstAction extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	private static final long serialVersionUID = 1L;
	private static final String sessionID  = null;
	private HttpSession session = null;
    public MFirstAction() {
        super();
     
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		System.out.println("*****메인서블릿이동******");
		
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html; charset=UTF-8");
		
		
		String action_code = request.getParameter("action_code");
		RequestDispatcher view = null;
		PrintWriter out =response.getWriter();
		
		String numMode = request.getParameter("num");
		int start = numMode != null ? Integer.parseInt(numMode) : -1;
		
		if(action_code.equals("start")){
			
			switch(start){
			case 1:
				System.out.println("******플래쉬 화면이동*****");
				request.setAttribute("check","0");
				view = request.getRequestDispatcher("/Main/FirstMain/Fm_Main.jsp");
				view.forward(request, response);
				break;
			case 2:
				System.out.println("******(할배할매)로그인 화면이동*****");
				request.setAttribute("check","1");
				
				view = request.getRequestDispatcher("/Main/FirstMain/Fm_Main.jsp");
				view.forward(request, response);
				break;
			case 3:
				System.out.println("******(젊은부부)로그인 화면이동*****");
				request.setAttribute("check","2");
				
				view = request.getRequestDispatcher("/Main/FirstMain/Fm_Main.jsp");
				view.forward(request, response);
				break;
			case 4:
				System.out.println("******중복로그인 발생이동*****");
				request.setAttribute("check","3");
				
				view = request.getRequestDispatcher("/Main/FirstMain/Fm_Main.jsp");
				view.forward(request, response);
				break;
			case 5:
				System.out.println("******방문자 발생이동*****");
				request.setAttribute("check","7");
				
				view = request.getRequestDispatcher("/Main/FirstMain/Fm_Main.jsp");
				view.forward(request, response);
				break;
			}
		}
	}
}
